package chaos.infinity.mixin.NoFloatCanExtend;

import com.mojang.serialization.MapCodec;
import it.unimi.dsi.fastutil.objects.Reference2ObjectArrayMap;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.IntProperty;
import net.minecraft.state.property.Properties;
import net.minecraft.state.property.Property;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;

@Mixin(Block.class)
public abstract class ExtendState_Mixin {
    @Shadow
    protected StateManager<Block, BlockState> stateManager;
    @Shadow
    protected final void setDefaultState(BlockState state) {};

//    @Inject(method = "init(Lcom/mojang/serialization/MapCodec;Lnet/minecraft/block/AbstractBlock$Settings;)V", at = @At(value = "TAIL"), locals = LocalCapture.CAPTURE_FAILSOFT)
//    protected void Block_Mixin(
//            AbstractBlock.Settings settings,
//            CallbackInfo ci
//    ) {
//        // 添加属性
//        IntProperty MAXEXTEND = IntProperty.of("MAXEXTEND", 0, 32);
//        IntProperty DISTANCE = IntProperty.of("DISTANCE", 0, 32);
//        // 获取当前方块的状态管理器构建器
////        StateManager.Builder<Block, net.minecraft.block.BlockState> builder = getStateManagerBuilder();
//        // 添加属性到状态管理器
//        builder.add(MAXEXTEND, DISTANCE);
//        this.setDefaultState(this.stateManager.getDefaultState().with(MAXEXTEND, (int)(((AbstractBlock)(Object)this).getHardness() * 4) - 1).with(DISTANCE, 0));
//    }
}
